#ifndef __WZLIB_WZLIBPTR_H
#define __WZLIB_WZLIBPTR_H
#include "WZLibConfig.h"

#include <string>

#include "WZLib.h"

#pragma warning(disable:4661)

namespace WZLibPtr{
	//Forward Declarations
	class WZFile;
	class WZDirectory;
	class WZImage;
	class WZImageProperty;
	//Below is commented out since their functionality is
	//included in WZImageProperty (hopefully)
	/*class WZCompressedIntProperty;
	class WZUnsignedShortProperty;
	class WZVectorProperty;
	class WZStringProperty;
	class WZNullProperty;
	class WZFloatProperty;
	class WZDoubleProperty;
	class WZUOLProperty;
	class WZSoundProperty;
	class WZCanvasProperty;
	class WZConvexProperty;
	class WZSubProperty;//*/
	//===
	template <typename T> class WZLibSmartPtr{
	protected:
		T*		_data;
	public:
		ctor	WZLibSmartPtr(T* data=NULL){this->_data=data;}
		//operators
		T*		operator->(){return this->_data;}
		void	operator=(T* data){this->_data=data;}
		bool	isValid(){return (this->_data!=NULL);}
	};

	template class WZLibSmartPtr<WZLib::WZFile>;
	class WZFile:public WZLibSmartPtr<WZLib::WZFile>{
	public:
		ctor			WZFile(WZLib::WZFile* data=NULL);
		//methods
		WZDirectory		getDir(std::string name);
		WZImage			getImg(std::string name);
		void				free();
		static WZFile	Open(std::string name,bool searchSearchDirectory=true);
	};

	template class WZLibSmartPtr<WZLib::WZDirectory>;
	class WZDirectory:public WZLibSmartPtr<WZLib::WZDirectory>{
	public:
		ctor			WZDirectory(WZLib::WZDirectory* data=NULL);
		//methods
		WZDirectory		getDir(std::string name);
		WZImage			getImg(std::string name);
	};

	template class WZLibSmartPtr<WZLib::WZImage>;
	class WZImage:public WZLibSmartPtr<WZLib::WZImage>{
	public:
		ctor			WZImage(WZLib::WZImage* data=NULL);
		//methods
		int				size();
		void				free();
		//operators
		WZImageProperty	operator[](std::string name);
		WZImageProperty operator[](int index);
	};

	template class WZLibSmartPtr<WZLib::WZImageProperty>;
	template class WZLibSmartPtr<WZLib::WZPNGProperty>;
	typedef WZLibSmartPtr<WZLib::WZPNGProperty> WZPNGProperty;
	class WZImageProperty:public WZLibSmartPtr<WZLib::WZImageProperty>{
	public:
		ctor			WZImageProperty(WZLib::WZImageProperty* data=NULL);
		//possible values
		union{
			const char*		stringValue;
			int				intValue;
			double			doubleValue;
			int				vectorValue[2];
		};
		//methods
		int				size();
		WZPNGProperty	png();
		//operators
		WZImageProperty operator[](std::string name);
		WZImageProperty operator[](int index);
	};
};

#endif
